package uqbar.comm;

import java.util.ArrayList;
import java.util.List;

public abstract class AbstractPort implements Port {
	private List<PortListener> observers = new ArrayList<PortListener>();

	@Override
	public void addPortListener(final PortListener portListener) {
		this.observers.add(portListener);
	}

	@Override
	public void removePortListener(final PortListener portListener) {
		this.observers.remove(portListener);
	}

	protected void notifyDataAvailable() {
		for (PortListener listener : this.observers) {
			listener.dataAvailable(this);
		}
	}
}
